<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            padding: 0;
            margin: 0;
        }
        section{
            width: 800px;
            height: 500px;
            border: 1px solid red;
            margin: 50px auto 0;
            position: relative;
        }
        div{
            width: 50px;
            height: 50px;
            background-color: yellow;
            position: absolute;
            left: 0;
            top: 0;
            animation: kuai 4s linear infinite;
        }
        @keyframes kuai {
            0%{
                top: 0;
                left: 0;
                background-color: yellow;
            }
            25%{
                top: 0;
                left: 750px;
                background-color: rgb(81, 201, 65);
            }
            50%{
                top: 450px;
                left: 750px;
                background-color: rgb(17, 144, 153);
            }
            75%{
                top: 450px;
                left: 0;
                background-color: rgb(240, 86, 171);
            }
            100%{
                top:0;
                left: 0;
                background-color: rgb(22, 15, 82);
            }
        }
    </style>
</head>
<body>
    <section>
        <div></div>
    </section>
</body>
</html>